import actionType from "./actionType"
const initState={
    list:[]
}

const reducer=(state=initState,action)=>{
    const {type,payload}=action
    const {list}=state
    switch (type) {
        case actionType.SET_LIST:
            return{
                ...state,
                list:payload
            }
        case actionType.DELETE_BTN:
            const newList=list.filter(item=>item.id!==payload)
            return{
                ...state,
                list:newList
            }
        default:
            return{
                ...state
            }
    }
}

export default reducer